#include <fstream>
#include <string>

#include <sstream>
#include <iostream>

#include "GraphCreator.cpp"
#include "ConnectivityAnalyser.cpp"
#include "ReadGraph.cpp"
#include "BreadthFirstSearch.cpp"

#include <stdlib.h> 
#include <time.h> 

using namespace std;

int main(int argc, char* argv[])
{

	GraphCreator creator(time(NULL));
	cout << "Graph Created \t" << "Number of Nodes :"<< creator.nodeCount << "\t " << "Number of Edges :" << creator.edgeCount << endl;
	
	ReadGraph reader;
	cout << "Graph Read \t " <<"Callers: " << reader.edgeEnd.size() << "\t Recievers: " << reader.edgeStart.size() << endl;


	Graph graph(creator.vert.size());
	
	for(int i = 0 ; i < reader.edgeEnd.size(); i++)
	{
		graph.addEdge(reader.edgeStart.at(i), reader.edgeEnd.at(i));
	}

	int testedNode = 2;
	string result = graph.BFS(testedNode);

	cout << "Breadth First Search: " << endl << "Number of Connected Nodes: " << graph.count << endl;

	stringstream fullAns;
	double ans = ((double)graph.count / (double)graph.numNodes);
	ans = ans * 100;
	fullAns << ans;

	cout << "Percentage of Nodes Connected to Node "<< testedNode << " = " << fullAns.str() << "%" << endl;
	
	char seeConectedNodes = 'f';
	cout << "Would you like to see the conected nodes:" << endl;
	cin >> seeConectedNodes;

	if(seeConectedNodes == 'y')
	{
		cout << result << endl;
	}

	system("pause");
	return 0;
}

